<script type="text/javascript">
    // increase the default animation speed to exaggerate the effect
    $(document).ready(function() {	
        var r= $('.display').dataTable({
            "bPaginate": false,
            "bLengthChange": false,
            "bFilter": true,
            "bSort": false,
            "bInfo": false,
            "bAutoWidth": false                     
        });
    });
</script>
<table class="tabla" style="width: 95%"  >
    <thead>
        <tr>
            <th>No</th>
            <th></th>
            <th>Estado</th>
            <th>Observación</th>
            <th></th>
            <th colspan ="5"></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($cuentas as $cuenta): ?>
            <tr>
                <td><?php echo $cuenta['Account']['numero'] ?></td>
                <td>
                    <table border="1">
                        <tbody>
                            <tr>
                                <td>Fecha de inicio</td>
                                <td><?php echo $cuenta['Account']['fecha_inicio'] ?></td>
                            </tr>
                            <tr>
                                <td>fecha finalización</td>
                                <td><?php echo $cuenta['Account']['fecha_final'] ?></td>
                            </tr>
                            <tr>
                                <td>Monto</td>
                                <td><?php echo '$ ' . number_format($cuenta['Account']['monto'], 0, ',', '.') ?></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td><?php echo $cuenta['Account']['estado'] ?></td>
                <td><?php echo $cuenta['Account']['observacion'] ?></td>
                <td>
                    <?php //if ($cuenta['Account']['estado'] != "Aceptada" and $cuenta['Account']['estado'] != "Revisión"): ?>
                        <table border="1"  cellpadding="10" >
                            <tbody>
                                <tr>
                                    <td> <?php echo $this->Ajax->link('Informe_de_Actividades', array('controller' => 'AccountObligations', 'action' => 'index', $cuenta['Account']['id']), array('update' => 'content', 'indicator' => 'loading', 'title' => 'Crear el informe  agregando actividades que están en el contrato ', 'class' => 'actions')) ?></td>
                                </tr>
                                <tr>
                                    <td><?php echo $this->Ajax->link('Formato F-16', array('controller' => 'Accounts', 'action' => 'edit_retention', $cuenta['Account']['id'], 1), array('class' => 'actions', 'update' => 'content', 'indicator' => 'loading', 'title' => 'Crear o editar  formato F-16', 'complete' => 'cargar()')) ?></td>
                                </tr>
                                <tr>
                                    <td><?php echo $this->Ajax->link('Certificación estandar', array('controller' => 'Accounts', 'action' => 'edit_contract_certification', $cuenta['Account']['id'], 1), array('class' => 'actions', 'update' => 'content', 'indicator' => 'loading', 'title' => 'Crear o editar  formato F-17', 'complete' => 'cargar()')) ?></td>
                                </tr>
                                <tr>
                                    <td><?php echo $this->Ajax->link('Enviar a revisión', array('controller' => 'Accounts', 'action' => 'change_state', $cuenta['Account']['id'], $contract_id), array('class' => 'actions', 'update' => 'content', 'indicator' => 'loading', 'title' => 'Enviar a revisón'), "¿Desea enviar esta cuenta de cobro a revisión?") ?></td>
                                </tr>
                            </tbody>
                        </table>
                    <?php //endif; ?>
                </td>
                <td>
                    <?php echo $this->Ajax->link('*IMPRIMIR*', array('controller' => 'Accounts', 'action' => 'print_index', $cuenta['Account']['id']), array('class' => 'actions', 'update' => 'content', 'indicator' => 'loading', 'title' => 'Imprimir todos los documentos de esta cuenta')) ?>
                    <br><br>
                    <?php
                    //if ($cuenta['Account']['estado'] != "Aceptada" and $cuenta['Account']['estado'] != "Revisión")
                        echo $this->Ajax->link('Editar', array('controller' => 'Accounts', 'action' => 'edit', $cuenta['Account']['id']), array('class' => 'actions', 'update' => 'content', 'complete' => 'cargar()', 'title' => 'Imprimir todos los documentos de esta cuenta'))
                        ?>
                </td>        
            </tr>            
        <?php endforeach; ?>
    </tbody>
</table>
<br><br><br>
<table border="0"   align="center">
    <tr>
        <td>Regresar</td>
        <td>Agregar cuenta de cobro</td>
        <td>Imprimir informe final</td>
    </tr>
    <tr>
        <td align="center"> <?php echo $this->Ajax->link($this->Html->image("regresar.gif", array('width' => '30', 'heigth' => '30', 'alt' => 'Adicionar usuario')), array('controller' => "Contracts", "action" => "index", $this->Session->read('contract_user')), array('update' => 'content', 'indicator' => 'loading', 'escape' => false), null) ?></td>
        <td align="center"><?php echo $this->Ajax->link($this->Html->image("add.png", array('width' => '30', 'heigth' => '30', 'alt' => 'Adicionar cuenta')), array('controller' => "Accounts", "action" => "add", $contract_id), array('update' => 'content', 'indicator' => 'loading', 'escape' => false, 'complete' => 'cargar()')) ?></td>
        <td align="center"> <?php echo $this->Html->link($this->Html->image("pdf.png", array('width' => '30', 'heigth' => '30', 'alt' => 'Adicionar proyecto')), array('controller' => "AccountObligations", "action" => "total_report", $contract_id), array('target' => '_blank', 'escape' => false)) ?></td>
    </tr>
</table>